/*
 * Copyright (c) 2007, TopCoder, Inc. All rights reserved
 */

namespace TopCoder.Util.Calendar.Entry
{
    /// <summary>
    /// <para>
    /// Helper class that defines utility methods used in this component.
    /// </para>
    /// </summary>
    /// <remarks>
    /// <para>
    /// Thread-safety: This class is immutable and thread-safe.
    /// </para>
    /// </remarks>
    ///
    /// <author>fuyun</author>
    /// <version>1.0</version>
    /// <copyright>Copyright (c) 2007, TopCoder, Inc. All rights reserved.</copyright>
    public sealed class CalendarHelper
    {
        /// <summary>
        /// <para>
        /// Private constructor to avoid the instantiation of this class.
        /// </para>
        /// </summary>
        private CalendarHelper()
        {
        }

        /// <summary>
        /// <para>Simply compares the two object just by whether they are null.</para>
        /// </summary>
        /// <param name="x">The first object to compare.</param>
        /// <param name="y">The second object to compare.</param>
        /// <returns>
        /// -1 -- only x is null. Zero --  x and y are both null. 1 -- only y is null.
        /// <c>int.MaxValue</c> if x and y are both not null.
        /// </returns>
        internal static int compare(object x, object y)
        {
            if (x == null && y == null)
            {
                return 0;
            }
            else if (x == null)
            {
                return -1;
            }
            else if (y == null)
            {
                return 1;
            }

            return int.MaxValue;
        }
    }
}